Open
Conversation
- Add internal/ui/widgets/state_panel.go — DiffKind (added/removed/changed/same), ComputeDiff() diffs ExecutionState.HostState maps; StatePanel renders a 3-column table (indicator│Key│Old Value│New Value) with colour coding, proportional column widths, scrolling, and a Summary() status line - Add internal/ui/styles.go — centralised ANSI colour constants, Colorize(), NoColor global, DefaultBorder; widgets package exports its own copy to keep the dependency graph acyclic - Update internal/ui/layout.go — add PaneDiff pane constant, ShowDiff field, ToggleDiff(), MiddleWidth()/RightWidth() for three-pane column arithmetic, extend Render() signature to accept leftLines/middleLines/rightLines - Update internal/ui/trace_view.go — add diffPanel field and etrace param to NewTraceView; refreshDiff() wires ExecutionTrace steps to StatePanel.SetStates; HandleKey routes KeyDiff to ToggleDiff and PaneDiff nav to panel scroll - Update internal/ui/keys.go — add KeyDiff constant, map 'd'/'D' to it
|
@ezedike-evan Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Owner
|
fix ci. |
Owner
|
fix ci, tho. |
Contributor
Author
the CI has been fixed |
Contributor
Author
|
@dotandev please your workflow are flagging files i didn't work on please review what is wrong |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
================================================================================
TITLE:
feat(ui): Implement State Diff Panel in Interactive Mode - Issue #1006
DESCRIPTION:
Overview
Implements a resizable, scrollable three-column State Diff panel for the
interactive split-screen trace viewer. The panel shows exactly what changed in
ExecutionState.HostStatebetween consecutive execution steps, with colour-codedadditions, removals, and modifications.
Changes
Core Implementation
StatePanel (
internal/ui/widgets/state_panel.go): New diff widgetComputeDiff(prev, curr *ExecutionState)diffsHostState map[string]interface{}between two consecutive steps — the native state change structure in the codebase
DiffKindenum:DiffAdded(green+),DiffRemoved(red-),DiffChanged(yellow~),DiffSame(dim) — with stable sort priority:changed → added → removed → same, alphabetical within groups
StatePanel.Lines(width, maxRows int)renders the 3-column table(indicator │ Key │ Old Value │ New Value) into a
[]stringslice thelayout consumes directly
SelectUp/Down()withscrollToptracking for full keyboard scrollabilitySummary()returns+N -N ~Ncount string for status barsSetNoColor(bool)for piped/non-TTY outputStyles (
internal/ui/styles.go): New centralised styling moduleuipackageColorize(text, style string)withNoColorglobal for piped outputDefaultBorderstruct for consistent border character setswidgetspackage exports its ownColorizecopy to keep the dependencygraph acyclic (widgets → trace only, not widgets → ui)
Layout Extension (
internal/ui/layout.go): Three-pane supportPaneDiffconstant added to thePaneiota alongside existingPaneTraceandPaneStateShowDiff boolfield andToggleDiff()method — hides diff panel andmoves focus to
PaneStateif diff panel had focus when closedMiddleWidth()/RightWidth()— two-pane: middle fills all remainingspace, right returns 0; three-pane: remaining split 50/50
Render()signature extended toRender(leftLines, middleLines, rightLines []string);top/bottom borders extend automatically when
ShowDiffis trueSplitRatioadjusted from 0.5 → 0.4 to give equal breathing room acrossthree panes at typical terminal widths
TraceView Wiring (
internal/ui/trace_view.go): Diff panel integrationdiffPanel *widgets.StatePanelfield added toTraceViewNewTraceViewnow acceptsetrace *trace.ExecutionTrace(nil-safe) —pass nil to disable the diff panel without breaking existing callers
refreshDiff()looks upetrace.States[currentStep]andStates[currentStep-1], passes both todiffPanel.SetStates(prev, curr);step 0 passes
prev=nilso all keys appear asDiffAddedrefreshDiff()called alongsiderefreshState()on every tree navigationevent so the diff panel always reflects the selected step
HandleKeyroutesKeyDifftoToggleDiff()and dispatchesPaneDiffUp/Down events to
diffPanel.SelectUp/Down()Key Binding (
internal/ui/keys.go): Diff toggle keyKeyDiffconstant added to theKeyiota'd'/'D'mapped toKeyDiffinKeyReader.Read()Integration
Update
NewTraceViewcall site to pass theExecutionTrace:Toggle the diff panel at runtime with
d. Navigate it with↑/↓afterswitching focus with
Tabor→.Testing
ComputeDiffcorrectly classifies added, removed, changed, and unchanged keysDiffAddedToggleDiffhides panel and reassigns focus whenPaneDiffwas activeSummary()returns correct+N -N ~Ncounts across all diff kindsRelated Issues
Closes #1006
Type of Change
Checklist
================================================================================